/**to send notify SMS by template, there are some tag such as [webname] in the template, 
 * so the program will load these parameters by CParamDao
 * by fuzhou huilin corp.ltd
 * LGX 2017年1月10日
 */
package com.fzrskj.cloud.free.core.utils;

import com.fzrskj.cloud.free.core.tool.CRegularTool;
import com.fzrskj.cloud.free.core.tool.CStrTool;
import com.fzrskj.cloud.free.dic.utils.DicParamUtils;
import ms.core.object.CObject;
import ms.core.tool.HttpTool;


public class WhoisUtils extends CObject {
	private String RawWiniisWhoisSerch(String domainname){
		HttpTool http=new HttpTool();
		String whoisUrl = DicParamUtils.getParamValue("whoisAddress");
		if(CStrTool.isBlankStr(whoisUrl)){
			return "接口未配置,请联系管理员";
		}

		if(CRegularTool.isContainChinese(domainname)) {
			domainname = java.net.IDN.toASCII(domainname);
		}

		return http.httpGet(whoisUrl+"/rawwhois.do?d="+domainname);
	}

	public static String RawWiniisWhois(String domainname){
		WhoisUtils whois=new WhoisUtils();
		return  whois.RawWiniisWhoisSerch(domainname);
	}
	private String WiniisWhoisSerch(String domainname){
		HttpTool http=new HttpTool();
		String whoisUrl = DicParamUtils.getParamValue("whoisAddress");
		if(CStrTool.isBlankStr(whoisUrl)){
			return "接口未配置,请联系管理员";
		}
		return http.httpGet(whoisUrl+"/whois.do?d="+domainname);
	}

	public static String WiniisWhois(String domainname){
		WhoisUtils whois=new WhoisUtils();
		return  whois.WiniisWhoisSerch(domainname);
	}

	public static void main(String[] args) {
		System.out.println(WhoisUtils.RawWiniisWhois("wuzujian.com"));
	}
}